package com.example.springmvc.controller;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 不需要Controller注解的方式
 */
public class TestController implements Controller {
    @Override
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        //数据模型和视图对象
        ModelAndView mv = new ModelAndView();
        mv.addObject("name","这是要显示的值");

        mv.setViewName("hello");
        return mv;
    }
}
